const Student = require("./student.js").Student;
const Klass = require("./klass.js").Klass;
const Teacher = require('./teacher.js').Teacher;

function teacherTestNotNullKlass() {
    let teacher = new Teacher('Tom', 21, [new Klass(2),new Klass(3)]);
    let expectResult = 'My name is Tom. I am 21 years old. I am a Teacher. I teach Class 2,3.';
    console.log(teacher.introduce());
    if (teacher.introduce() === expectResult) {
        console.log('test passed');
    } else {
        console.log('test failed');
    }
}

function teacherTestNullKlass() {
    let teacher = new Teacher('Tom', 21,[]);
    let expectResult = 'My name is Tom. I am 21 years old. I am a Teacher. I teach no Class.';
    if (teacher.introduce() === expectResult) {
        console.log('test passed');
    } else {
        console.log('test failed');
    }
}

function teacherIsTeaching(){
    let klass = new Klass(2);
    let teacher = new Teacher('Tom',21,[klass,new Klass(3)]);
    let jerry = new Student('Jerry',21,klass);
    if(teacher.isTeaching(jerry) === true){
        console.log('test passed');
    }else{
        console.log('test failed');
    }
}

teacherTestNotNullKlass();

teacherTestNullKlass();

teacherIsTeaching();